package ar.edu.itba.it.cg.grupo01.state;

import ar.edu.itba.it.cg.grupo01.game.BaseGame;
import ar.edu.itba.it.cg.grupo01.vehicle.Hud;

import com.jme.input.InputHandler;
import com.jme.scene.Node;
import com.jme.util.Timer;

/**
 * User: cabe
 * Date: Jul 4, 2010
 * Time: 6:18:44 PM
 */
public class PlayState extends MyGameState {

    private BaseGame game;
    private final String name = "PLAY STATE";

    public void setLastState(GameStateType lastState) {
        
        this.lastState = lastState;
    }

    private GameStateType lastState = this.getType();

    public PlayState(Node rootNode, InputHandler input, BaseGame game, Hud hud) {

        super(GameStateType.PLAY, rootNode, input,hud);
        this.game = game;
    }

    public void enterState() {

        System.out.println("Entered PLAY STATE");
        lastState = getType();
        this.game.setActive(true);
    }

    public void leaveState() {

        System.out.println("Left PLAY STATE");
        this.game.setActive(false);

    }

    @Override
    public GameStateType update(Timer timer) {

        return lastState;
    }

    public void render() {

        this.game.render();
    }

    public String getName() {

        return this.name;
    }
}
